
package com.itheima.config;

import com.itheima.utils.ActiveMqUtil;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.jms.ConnectionFactory;

/**
 * @Description: 消息队列
 */
@Configuration
public class ActiveMQConfig {

    @Value("${spring.activemq.broker-url}")
    private String brokerUrl;

    /**
     * 使用连接池
     */
    @Bean(name = "connectionFactory")
    public ConnectionFactory getConnectionFactory() {
        return new PooledConnectionFactory(brokerUrl);
    }

}